const state = {
	urls: {
		amsurl: '',
		ccsurl: '',
		serverUrl: '',
		uploadUrl: '',
		backendurl: '',
		turnserverUrl: '',
		turnserverUsername: '',
		turnserverCredential: ''
	},
	userInfo: {
		org: '',
		name: '',
		userId: '',
		ticket: '',
		adminToken: '',
		role: '',
		loginTime: 0, // 登录时间
		// id,roleId,roles:[]
		userRole: {},
		pwdUpdateDeadline: '' // 密码过期时间 2025-03-03T15:59:59.999Z
	}
};

const mutations = {
	SET_LOGIN_USER_INFO(target, userInfo) {
		target.userInfo.org = userInfo.org;
		target.userInfo.name = userInfo.name;
		target.userInfo.userId = userInfo.userId;
		target.userInfo.ticket = userInfo.ticket;
		target.userInfo.adminToken = userInfo.adminToken;
		target.userInfo.role = userInfo.role;
		target.userInfo.loginTime = userInfo.loginTime;
		target.userInfo.userRole = userInfo.userRole;
		target.userInfo.pwdUpdateDeadline = userInfo.pwdUpdateDeadline;
	},
	SET_LOGIN_URLS(target, urls) {
		target.urls.amsurl = urls.amsurl;
		target.urls.ccsurl = urls.ccsurl;
		target.urls.serverUrl = urls.backendurl;
		target.urls.uploadUrl = urls.backendurl;
		target.urls.backendurl = urls.backendurl;
		target.urls.turnserverUrl = urls.turnserverUrl;
		target.urls.turnserverCredential = urls.turnserverCredential;
	}
};

export default {
	// namespaced: true,
	state,
	mutations
};
